<template>
  <div class="userDetail">
    <el-divider></el-divider>
    <span style="margin-right: 10px">代理商简称：</span>
    <span style="margin-left: 10px">{{ user.username }}</span>
    <el-divider></el-divider>
    <span style="margin-right: 10px">行业：</span>
    <span style="margin-left: 10px">{{ user.industry }}</span>
    <el-divider></el-divider>
    <span style="margin-right: 10px">简介：</span>
    <span style="margin-left: 10px">{{ user.description }}</span>
    <el-divider></el-divider>
    <span style="margin-right: 10px">公司名称：</span>
    <span style="margin-left: 10px">{{ user.companyName }}</span>
    <el-divider></el-divider>
    <span style="margin-right: 10px">联系人：</span>
    <span style="margin-left: 10px">{{ user.contactPerson }}</span>
    <el-divider></el-divider>
    <span style="margin-right: 10px">手机号：</span>
    <span style="margin-left: 10px">{{user.phoneNumber}}</span>
    <el-divider></el-divider>
    <span style="margin-right: 10px">qq号：</span>
    <span style="margin-left: 10px">{{ user.qq }}</span>
    <el-divider></el-divider>
    <span style="margin-right: 10px">微信号：</span>
    <span style="margin-left: 10px">{{ user.wechat }}</span>
    <el-divider></el-divider>
    <span style="margin-right: 10px">上架短视频数：</span>
    <span style="margin-left: 10px">{{ user.videoCount }}</span>
    <el-divider></el-divider>
  </div>
</template>

<script>
import {getUserOfId} from '../api'

export default {
  name: 'UserDetail',
  data() {
    return {
      user: {
        id: null,
        username: null,
        industry: null,
        description: null,
        companyName: null,
        contactPerson: null,
        phoneNumber: null,
        qq: null,
        wechat: null,
        videoCount: null
      }
    }
  },

  created() {
    const userId = this.$route.params.userId
    if (userId) {
      this.getMsg(userId)
    }

  },

  methods: {
    getMsg(id) {
      getUserOfId(id)
        .then(res => {
          this.user.id = res.data.id
          this.user.username = res.data.username
          this.user.industry = res.data.industry
          this.user.description = res.data.description
          this.user.companyName = res.data.companyName
          this.user.contactPerson = res.data.contactPerson
          this.user.phoneNumber = res.data.phoneNumber
          this.user.qq = res.data.qq
          this.user.wechat = res.data.wechat
          this.user.videoCount = res.data.videoCount
        })
        .catch(err => {
          console.log(err)
        })
    }
  }
}
</script>

<style scoped>
.userDetail {
  background-color: white;
  padding-left: 30px;
  margin-left: 30px;
}
</style>
